#!/usr/bin/env python
'''
Plots \ln(M_L) vs \ln(L) for set of temperatures
'''

import sys
sys.path += ['..']
import common
import os
import math
import matplotlib.pyplot

tList = [0.60, 0.62, 0.63, 0.64, 0.65, 0.70, 0.80, 0.90, 0.92, 0.95, 0.96, 1.00, 1.05]
path = os.path.join('..', '..', '..', '..', 'results', 'square_clock', 'J_1.0', 'q_6')

lList = common.choice(path)

# l1List = [ math.log(eval(tl.replace('L_',''))) for tl in lList ]

for tT in tList:
	mList = []
	lList1 = []
	for tL in lList:
		L = int( tL.replace('L_', '') )
		lPath = os.path.join(path, tL, 'X')
		Temperature, M, err  = common.sorted_list(lPath)
		try:
			tIndex = Temperature.index(tT)
		except:
			pass
		else:
			mList += [ math.log( M[tIndex] ) ]
			lList1 += [ math.log(L) ]

	
	matplotlib.pyplot.plot( lList1, mList,'*-', label = r'$T = %f$'%(tT))
matplotlib.pyplot.legend(loc = 'lower left', 'shadow = True)
matplotlib.pyplot.show()